package com.example.controller;

import com.example.feign.ProductFeignService;
import com.example.feign.ShortLinkFeignService;
import com.example.utils.JsonData;
import com.example.vo.ProductVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author yinxin
 * @version 1.0
 * @Description:
 * @date 2022/6/2719:14
 */
@RestController
@RequestMapping("/api")
@Slf4j
public class Test {

   @Autowired
   ShortLinkFeignService shortLinkFeignService;

   @Autowired
   ProductFeignService productFeignService;

   @GetMapping("test")
   public JsonData testFeign(){
      JsonData jsonData = shortLinkFeignService.check("040rjjKa");
      log.info("feign接口返回结果为:{}:后面是一段中问看看有没有乱码!",jsonData);
      return jsonData;
   }

   @GetMapping("test2")
   public void testFeign2(){
      List<ProductVO> info = productFeignService.getInfo();
      System.out.println(info);
   }
}
